package de.jmda.home.ui.vaadin.usermgmt;

import javax.ejb.EJB;

import com.vaadin.ui.TextField;

import de.jmda.common.ui.web.vaadin.service.DefaultSessionContext;
import de.jmda.home.bl.usermgmt.UserManagementBean;

public class UserRegistrationComponentController
{
	/**
	 * TODO make use of CDI as soon as possible
	 */
	@EJB
	private UserManagementBean userManagement =
			DefaultSessionContext.get().getUserManagement();

	public void register(TextField tfUsername, TextField tfEmail)
  {
		userManagement.createRegistrationRequest(
				tfUsername.getValue(), tfEmail.getValue());
  }

	public void cancel()
  {
		DefaultSessionContext.get().getEventBus().post(new EventRegisterCancel());
  }
}